<?php

namespace App\Http\Resources\OpenShop\ShopCheckAccept;

use App\Http\Resources\BaseResource;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use JsonSerializable;

class ShopCheckAcceptResource extends BaseResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  Request  $request
     * @return array
     */
    public function toArray($request): array
    {
        return [
            "id" => $this->id,
            "mainProcessId" => $this->mainProcessId,
            "orderNo" => $this->orderNo,
            "step" => $this->step,
            "managerName" => $this->managerName,
            "managerId" => $this->managerId,
            "assignTime" => formatDate($this->assignTime),
            "formContent" => $this->formContent ? json_decode($this->formContent, true) : "",
            "formSubmit" => $this->formSubmit ? json_decode($this->formSubmit, true) : "",
            "formSubmitTime" => formatDate($this->formSubmitTime),
            "provinceManagerConfirmTime" => formatDateYmd($this->provinceManagerConfirmTime),
            "createdAt" => formatDate($this->createdAt->timestamp),
            "updatedAt" => formatDate($this->updatedAt->timestamp),
        ];
    }
}
